require("World")
require("Society")

Field = class("Field")

---

function Field:initialize()

	gField = self
	
	self.entityTypes = {}
	self.beat = 0
	
	self.world = World:new()
	self.society = Society:new()
end  

---

function Field:removeEntity(entity)

	for type, entities in pairs(self.entityTypes) do		-- an entity can be registered with several types
	
		if entities[entity.name] == entity then
		
			entities[entity.name] = nil
		end
	end
	
	entity:onRemoval()
end

---

function Field:onBeat()

	self.world:onBeat()
	self.society:onBeat()
end